package kr.co.doriclassic.powerjava.chapter07;

public class StringTest {
	public static void main(String[] args) {
		String str1="Hello Java";
		String str2="MySQL";
		String str3="mysql";
		
		try {
			char ch = str1.charAt(9);
			System.out.println(ch);
			
			String result = (str1.compareTo(str2)==0)?"같음":"다름";
			System.out.println(result);
			
			System.out.println(str1.concat(str2));
			
			System.out.println(str1.equals(str2)?"같음":"다름");
			
			System.out.println(str2.equalsIgnoreCase(str3)?"같음":"다름");

			System.out.println(str1.isEmpty());
			System.out.println("".isEmpty());
			
			System.out.println(str1.length());
			
			for(int i=0;i<str1.length();i++){
				System.out.print(str1.charAt(i));
			}
			System.out.println();
			
			System.out.println(str1.replace('l', 'L'));
			
			System.out.println(str1.substring(6, 8));
			
			System.out.println(str1.toUpperCase());
			
			System.out.println(str2.toLowerCase());
		} catch (StringIndexOutOfBoundsException e) {
			System.out.println("인덱스 범위 초과 : 인덱스는 0 ~ "+(str1.length()-1)+"까지입니다.");
		}
		
		
	}
}
